package com.yanmaohu.yulia.bean;

import com.yanmaohu.yulia.statement.SqlSchemaDefinitionStatement;

/**
 * @author Bright Lee
 */
public final class RoleDefinition implements SchemaElement, SqlSchemaDefinitionStatement {

    private int beginIndex;
    private int endIndex;
    private Identifier roleName;
    private Grantor grantor;

    public RoleDefinition(int beginIndex, Identifier roleName, Grantor grantor) {
        this.beginIndex = beginIndex;
        this.endIndex = grantor != null ? grantor.getEndIndex() : roleName.getEndIndex();
        this.roleName = roleName;
        this.grantor = grantor;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

}
